package org.wekit.engine.pvm.runtime;

import org.wekit.engine.pvm.PvmEvent;
import org.wekit.engine.pvm.process.Activity;
import org.wekit.engine.pvm.process.ProcessDefinition;
import org.wekit.engine.pvm.process.Scope;

/**
 * 流程开始出发动作
 * @author HuangWeili
 *
 */
public class AtomicOperationProcessStart extends AbstractEventAtomicOperation {

	@Override
	protected Scope getScope(InterpretableExecution execution) {
		return execution.getProcessDefinition();
	}

	@Override
	protected String getEventName() {
		return PvmEvent.EVENTNAME_START;
	}

	/**
	 * 确定开始节点开始流转
	 */
	@Override
	protected void eventNotificationsCompleted(InterpretableExecution execution) {
		ProcessDefinition processDefinition=execution.getProcessDefinition();
		Activity initial=processDefinition.getInitial();
		execution.setActivity(initial);
		execution.performOperation(new AtomicOperationProcessStartInitial());
	}
}
